home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / biblio / bibtex / contrib / kluwer.bst < prev    next >
Text File  |  1994-07-31  |  25KB  |  1,353 lines

  1. % BibTeX standard bibliography style `kluwer' (one of the harvard family)
  2.     % version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09.
  3.     % Copyright (C) 1991, all rights reserved.
  4.     % Copying of this file is authorized only if either
  5.     % (1) you make absolutely no changes to your copy, including name, or
  6.     % (2) if you do make changes, you name it something other than
  7.     % btxbst.doc, plain.bst, unsrt.bst, alpha.bst, abbrv.bst, agsm.bst,
  8.         % dcu.bst or kluwer.bst.
  9.     % This restriction helps ensure that all standard styles are identical.
  10.     % The file harvard.tex has the documentation for this style.
  11.  
  12. % ACKNOWLEDGEMENT:
  13. %   This document is a modified version of alpha.bst to which it owes much of
  14. %   its functionality.
  15.  
  16. % AUTHOR
  17. %   Peter Williams, Key Centre for Design Quality, Sydney University
  18. %   e-mail: peterw@archsci.arch.su.oz.au
  19.  
  20. ENTRY
  21.   { address
  22.     author
  23.     booktitle
  24.     chapter
  25.     edition
  26.     editor
  27.     howpublished
  28.     institution
  29.     journal
  30.     key
  31.     month
  32.     note
  33.     number
  34.     organization
  35.     pages
  36.     publisher
  37.     school
  38.     series
  39.     title
  40.     type
  41.     URL
  42.     volume
  43.     year
  44.   }
  45.   { field.used etal.allowed etal.required }
  46.   { extra.label sort.label list.year }
  47.  
  48. INTEGERS { output.state before.all mid.sentence after.sentence after.block }
  49.  
  50. FUNCTION {init.state.consts}
  51. { #0 'before.all :=
  52.   #1 'mid.sentence :=
  53.   #2 'after.sentence :=
  54.   #3 'after.block :=
  55. }
  56.  
  57. STRINGS { s t f }
  58.  
  59. FUNCTION {output.nonnull}
  60. { 's :=
  61.   output.state mid.sentence =
  62.     { ", " * write$ }
  63.     { output.state after.block =
  64.     { add.period$ write$
  65.       newline$
  66.       "\newblock " write$
  67.     }
  68.     { output.state before.all =
  69.         'write$
  70.         { add.period$ " " * write$ }
  71.       if$
  72.     }
  73.       if$
  74.       mid.sentence 'output.state :=
  75.     }
  76.   if$
  77.   s
  78. }
  79.  
  80. FUNCTION {output}
  81. { duplicate$ empty$
  82.     'pop$
  83.     'output.nonnull
  84.   if$
  85. }
  86.  
  87. FUNCTION {output.check}
  88. { 't :=
  89.   duplicate$ empty$
  90.     { pop$ "empty " t * " in " * cite$ * warning$ }
  91.     'output.nonnull
  92.   if$
  93. }
  94.  
  95. FUNCTION {item.check}
  96. { 't :=
  97.   empty$
  98.     { "empty " t * " in " * cite$ * warning$ }
  99.     { skip$ }
  100.   if$
  101. }
  102.  
  103. FUNCTION {fin.entry}
  104. { add.period$
  105.   write$
  106.   newline$
  107. }
  108.  
  109. FUNCTION {new.block}
  110. { output.state before.all =
  111.     'skip$
  112.     { after.block 'output.state := }
  113.   if$
  114. }
  115.  
  116. FUNCTION {not}
  117. {   { #0 }
  118.     { #1 }
  119.   if$
  120. }
  121.  
  122. FUNCTION {and}
  123. {   'skip$
  124.     { pop$ #0 }
  125.   if$
  126. }
  127.  
  128. FUNCTION {or}
  129. {   { pop$ #1 }
  130.     'skip$
  131.   if$
  132. }
  133.  
  134. FUNCTION {field.or.null}
  135. { duplicate$ empty$
  136.     { pop$ "" }
  137.     'skip$
  138.   if$
  139. }
  140.  
  141. FUNCTION {emphasize}
  142. { duplicate$ empty$
  143.     { pop$ "" }
  144.     { "{\em " swap$ * "}" * }
  145.   if$
  146. }
  147.  
  148. FUNCTION {embolden}
  149. { duplicate$ empty$
  150.     { pop$ "" }
  151.     { "{\bf " swap$ * "}" * }
  152.   if$
  153. }
  154.  
  155. FUNCTION {quote}
  156. { duplicate$ empty$
  157.     { pop$ "" }
  158.     { "`" swap$ * "'" * }
  159.   if$
  160. }
  161.  
  162. FUNCTION {write.url}
  163. { URL empty$
  164.     { skip$ }
  165.     { "\newline\harvardurl{" URL * "}" * write$ newline$ }
  166.   if$
  167. }
  168.  
  169. INTEGERS { nameptr namesleft numnames }
  170.  
  171. FUNCTION {format.names}
  172. { 's :=
  173.   'f :=
  174.   #1 'nameptr :=
  175.   s num.names$ 'numnames :=
  176.   numnames 'namesleft :=
  177.     { namesleft #0 > }
  178.     { s nameptr f format.name$ 't :=
  179.       nameptr #1 >
  180.     { namesleft #1 >
  181.         { ", " * t * }
  182.         { t "others" =
  183.         { " et~al." * }
  184.         { " and " * t * }
  185.           if$
  186.         }
  187.       if$
  188.     }
  189.     't
  190.       if$
  191.       nameptr #1 + 'nameptr :=
  192.       namesleft #1 - 'namesleft :=
  193.     }
  194.   while$
  195. }
  196.  
  197. FUNCTION {format.authors}
  198. { author empty$
  199.     { "" }
  200.     { "{vv~}{ll}{, jj}{, f.}" author format.names }
  201.   if$
  202. }
  203.  
  204. FUNCTION {format.editors}
  205. { editor empty$
  206.     { "" }
  207.     { "{vv~}{ll}{, jj}{, f.}" editor format.names
  208.       editor num.names$ #1 >
  209.     { " (eds)" * }
  210.     { " (ed.)" * }
  211.       if$
  212.     }
  213.   if$
  214. }
  215.  
  216. FUNCTION {format.editors.reverse}
  217. { editor empty$
  218.     { "" }
  219.     { "{f.~}{vv~}{ll}{, jj}" editor format.names
  220.       editor num.names$ #1 >
  221.     { " (eds)" * }
  222.     { " (ed.)" * }
  223.       if$
  224.     }
  225.   if$
  226. }
  227.  
  228. FUNCTION {format.title}
  229. { title empty$
  230.     { "" }
  231.     { title "t" change.case$ }
  232.   if$
  233. }
  234.  
  235. FUNCTION {n.dashify}
  236. { 't :=
  237.   ""
  238.     { t empty$ not }
  239.     { t #1 #1 substring$ "-" =
  240.     { t #1 #2 substring$ "--" = not
  241.         { "--" *
  242.           t #2 global.max$ substring$ 't :=
  243.         }
  244.         {   { t #1 #1 substring$ "-" = }
  245.         { "-" *
  246.           t #2 global.max$ substring$ 't :=
  247.         }
  248.           while$
  249.         }
  250.       if$
  251.     }
  252.     { t #1 #1 substring$ *
  253.       t #2 global.max$ substring$ 't :=
  254.     }
  255.       if$
  256.     }
  257.   while$
  258. }
  259.  
  260. FUNCTION {format.btitle}
  261. { title emphasize
  262. }
  263.  
  264. FUNCTION {tie.or.space.connect}
  265. { duplicate$ text.length$ #3 <
  266.     { "~" }
  267.     { " " }
  268.   if$
  269.   swap$ * *
  270. }
  271.  
  272. FUNCTION {either.or.check}
  273. { empty$
  274.     'pop$
  275.     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  276.   if$
  277. }
  278.  
  279. FUNCTION {format.bvolume}
  280. { volume empty$
  281.     { "" }
  282.     { "Vol." volume tie.or.space.connect
  283.       series empty$
  284.     'skip$
  285.     { " of " * series emphasize * }
  286.       if$
  287.       "volume and number" number either.or.check
  288.     }
  289.   if$
  290. }
  291.  
  292. FUNCTION {format.number.series}
  293. { volume empty$
  294.     { number empty$
  295.     { series field.or.null }
  296.     { output.state mid.sentence =
  297.         { "number" }
  298.         { "Number" }
  299.       if$
  300.       number tie.or.space.connect
  301.       series empty$
  302.         { "there's a number but no series in " cite$ * warning$ }
  303.         { " in " * series emphasize * }
  304.       if$
  305.     }
  306.       if$
  307.     }
  308.     { "" }
  309.   if$
  310. }
  311.  
  312. FUNCTION {format.edition}
  313. { edition empty$
  314.     { "" }
  315.     { output.state mid.sentence =
  316.     { edition "l" change.case$ " edn" * }
  317.     { edition "t" change.case$ " edn" * }
  318.       if$
  319.     }
  320.   if$
  321. }
  322.  
  323. INTEGERS { multiresult }
  324.  
  325. FUNCTION {multi.page.check}
  326. { 't :=
  327.   #0 'multiresult :=
  328.     { multiresult not
  329.       t empty$ not
  330.       and
  331.     }
  332.     { t #1 #1 substring$
  333.       duplicate$ "-" =
  334.       swap$ duplicate$ "," =
  335.       swap$ "+" =
  336.       or or
  337.     { #1 'multiresult := }
  338.     { t #2 global.max$ substring$ 't := }
  339.       if$
  340.     }
  341.   while$
  342.   multiresult
  343. }
  344.  
  345. FUNCTION {format.pages}
  346. { pages empty$
  347.     { "" }
  348.     { pages multi.page.check
  349.     { "pp.~" pages n.dashify * }
  350.     { "p.~" pages * }
  351.       if$
  352.     }
  353.   if$
  354. }
  355.  
  356. FUNCTION {format.vol.num.pages}
  357. { volume embolden field.or.null
  358.   number empty$
  359.     'skip$
  360.     { "(" number * ")" * *
  361.       volume empty$
  362.     { "there's a number but no volume in " cite$ * warning$ }
  363.     'skip$
  364.       if$
  365.     }
  366.   if$
  367.   pages empty$
  368.     'skip$
  369.     { duplicate$ empty$
  370.     { pop$ format.pages }
  371.     { ",~" * pages n.dashify * }
  372.       if$
  373.     }
  374.   if$
  375. }
  376.  
  377. FUNCTION {format.chapter.pages}
  378. { chapter empty$
  379.     'format.pages
  380.     { type empty$
  381.     { "chapter" }
  382.     { type "l" change.case$ }
  383.       if$
  384.       chapter tie.or.space.connect
  385.       pages empty$
  386.     'skip$
  387.     { ", " * format.pages * }
  388.       if$
  389.     }
  390.   if$
  391. }
  392.  
  393. FUNCTION {format.in.ed.booktitle}
  394. { booktitle empty$
  395.     { "" }
  396.     { editor empty$
  397.     { booktitle emphasize }
  398.     { "{\em in} " format.editors.reverse * ", " * booktitle emphasize * }
  399.       if$
  400.     }
  401.   if$
  402. }
  403.  
  404. FUNCTION {empty.misc.check}
  405. { author empty$ title empty$ howpublished empty$
  406.   month empty$ year empty$ note empty$
  407.   and and and and and
  408.   key empty$ not and
  409.     { "all relevant fields are empty in " cite$ * warning$ }
  410.     'skip$
  411.   if$
  412. }
  413.  
  414. FUNCTION {format.thesis.type}
  415. { type empty$
  416.     'skip$
  417.     { pop$
  418.       type "t" change.case$
  419.     }
  420.   if$
  421. }
  422.  
  423. FUNCTION {format.tr.number}
  424. { type empty$
  425.     { "Technical Report" }
  426.     'type
  427.   if$
  428.   number empty$
  429.     { "t" change.case$ }
  430.     { number tie.or.space.connect }
  431.   if$
  432. }
  433.  
  434. FUNCTION {format.article.crossref}
  435. { key empty$
  436.     { journal empty$
  437.     { "need key or journal for " cite$ * " to crossref " * crossref *
  438.       warning$
  439.       ""
  440.     }
  441.     { "in {\em " journal * "\/}" * " \cite{" * crossref * "}" *
  442.         }
  443.       if$
  444.     }
  445.     { " {\em in} \citeasnoun{" crossref * "}" * }
  446.   if$
  447. }
  448.  
  449. FUNCTION {format.book.crossref}
  450. { volume empty$
  451.     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  452.       "in "
  453.     }
  454.     { "Vol." volume tie.or.space.connect
  455.       " of " *
  456.     }
  457.   if$
  458.   editor empty$
  459.   editor field.or.null author field.or.null =
  460.   or
  461.     { key empty$
  462.     { series empty$
  463.         { "need editor, key, or series for " cite$ * " to crossref " *
  464.           crossref * warning$
  465.           "" *
  466.         }
  467.         { "{\em " * series * "\/}" * " \cite{" * crossref * "}" *}
  468.       if$
  469.     }
  470.     { " \citeasnoun{" * crossref * "}" * }
  471.       if$
  472.     }
  473.     { " \citeasnoun{" * crossref * "}" * }
  474.   if$
  475. }
  476.  
  477. FUNCTION {format.incoll.inproc.crossref}
  478. { editor empty$
  479.   editor field.or.null author field.or.null =
  480.   or
  481.     {
  482.       key empty$
  483.     { booktitle empty$
  484.         { "need editor, key, or booktitle for " cite$ * " to crossref " *
  485.           crossref * warning$
  486.           ""
  487.         }
  488.         { "in {\em " booktitle * "\/}" * " \cite{" * crossref * "}" *}
  489.       if$
  490.     }
  491.     { " {\em in} \citeasnoun{" crossref * "}" * }
  492.       if$
  493.     }
  494.     {  " {\em in} \citeasnoun{" crossref * "}" * }
  495.   if$
  496.  
  497. }
  498.  
  499. INTEGERS { len }
  500.  
  501. FUNCTION {chop.word}
  502. { 's :=
  503.   'len :=
  504.   s #1 len substring$ =
  505.     { s len #1 + global.max$ substring$ }
  506.     's
  507.   if$
  508. }
  509.  
  510. INTEGERS { ind tsslen }
  511.  
  512. STRINGS { tss ret rss istr }
  513.  
  514. FUNCTION {replace.substring}{
  515.   'rss :=
  516.   'tss :=
  517.   'istr :=
  518.   "" 'ret :=
  519.   tss text.length$ 'tsslen :=
  520.   #1 'ind :=
  521.     { istr ind tsslen substring$ "" = not }
  522.     { istr ind tsslen substring$ tss =
  523.         { ret rss * 'ret :=
  524.           ind tsslen + 'ind :=
  525.         }
  526.         { ret istr ind #1 substring$ * 'ret :=
  527.           ind #1 + 'ind :=
  528.         }
  529.       if$
  530.     }
  531.   while$
  532.   ret
  533. }
  534.  
  535. FUNCTION {format.lab.names.abbr}
  536. { 's :=
  537.   s num.names$ 'numnames :=
  538.   numnames #1 >
  539.     { numnames #2 >
  540.     { s #1 "{vv~}{ll}" format.name$ " et~al." * }
  541.     { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  542.             { s #1 "{vv~}{ll}" format.name$ " et~al." * }
  543.         { s #1 "{vv~}{ll}" format.name$ " and " *
  544.               s #2 "{vv~}{ll}" format.name$ * 
  545.             }
  546.           if$
  547.         }
  548.       if$
  549.     }
  550.     { s #1 "{vv~}{ll}" format.name$ }
  551.   if$
  552. }
  553.  
  554. FUNCTION {format.lab.names.full}
  555. { 's :=
  556.   #1 'nameptr :=
  557.   s num.names$ 'numnames :=
  558.   numnames 'namesleft :=
  559.     { namesleft #0 > }
  560.     { s nameptr "{vv~}{ll}" format.name$ 't :=
  561.       nameptr #1 >
  562.     { namesleft #1 >
  563.         { ", " * t * }
  564.         { t "others" =
  565.         { " et~al." * }
  566.         { " and " * t * }
  567.           if$
  568.         }
  569.       if$
  570.     }
  571.     't
  572.       if$
  573.       nameptr #1 + 'nameptr :=
  574.       namesleft #1 - 'namesleft :=
  575.     }
  576.   while$
  577. }
  578.  
  579. INTEGERS { author.field editor.field organization.field title.field key.field }
  580.  
  581. FUNCTION {init.field.constants}
  582. { #0 'author.field :=
  583.   #1 'editor.field :=
  584.   #2 'organization.field :=
  585.   #3 'title.field :=
  586.   #4 'key.field :=
  587. }
  588.  
  589. FUNCTION {make.list.label}
  590. { author.field field.used =
  591.     { format.authors }
  592.     { editor.field field.used =
  593.         { format.editors }
  594.         { organization.field field.used =
  595.             { "The " #4 organization chop.word #3 text.prefix$ }
  596.             { title.field field.used =
  597.                 { format.btitle }
  598.                 { key.field field.used =
  599.                     { key #3 text.prefix$ }
  600.                     { "Internal error :001 on " cite$ * " label" * warning$ }
  601.                   if$
  602.                 }
  603.               if$
  604.             }
  605.           if$
  606.         }
  607.       if$
  608.     }
  609.   if$
  610. }
  611.  
  612. FUNCTION {make.full.label}
  613. { author.field field.used =
  614.     { author format.lab.names.full }
  615.     { editor.field field.used =
  616.         { editor format.lab.names.full }
  617.         { organization.field field.used =
  618.             { "The " #4 organization chop.word #3 text.prefix$ }
  619.             { title.field field.used =
  620.                 { format.btitle }
  621.                 { key.field field.used =
  622.                     { key #3 text.prefix$ }
  623.                     { "Internal error :001 on " cite$ * " label" * warning$ }
  624.                   if$
  625.                 }
  626.               if$
  627.             }
  628.           if$
  629.         }
  630.       if$
  631.     }
  632.   if$
  633. }
  634.  
  635. FUNCTION {make.abbr.label}
  636. { etal.allowed
  637.     { author.field field.used =
  638.         { author format.lab.names.abbr }
  639.         { editor.field field.used =
  640.             { editor format.lab.names.abbr }
  641.             { organization.field field.used =
  642.                 { "The " #4 organization chop.word #3 text.prefix$ }
  643.                 { title.field field.used =
  644.                     { format.btitle }
  645.                     { key.field field.used =
  646.                         { key #3 text.prefix$ }
  647.                         {"Internal error :001 on " cite$ * " label" * warning$ }
  648.                       if$
  649.                     }
  650.                   if$
  651.                 }
  652.               if$
  653.             }
  654.           if$
  655.         }
  656.       if$
  657.     }
  658.     { make.full.label }
  659.   if$
  660. }
  661.  
  662. FUNCTION {output.bibitem}
  663. { newline$
  664.   etal.allowed        %%%XXX change
  665.   etal.required
  666.   and
  667.     {
  668.       "\harvarditem[" write$
  669.       make.abbr.label write$
  670.       "]{" write$
  671.     }
  672.     {
  673.       "\harvarditem{" write$
  674.     }
  675.   if$
  676.   make.full.label write$
  677.   "}{" write$
  678.   list.year write$
  679.   "}{" write$
  680.   cite$ write$
  681.   "}" write$
  682.   newline$
  683.   ""
  684.   before.all 'output.state :=
  685. }
  686.  
  687.  
  688. FUNCTION {list.label.output}
  689. { make.list.label write$
  690. }
  691.  
  692. FUNCTION {article}
  693. { output.bibitem
  694.   list.label.output
  695.   ": " list.year * output.nonnull
  696.   author "author" item.check
  697.   title.field field.used =
  698.     { skip$ }
  699.     { format.title "title" output.check }
  700.   if$
  701.   crossref missing$
  702.     { journal emphasize "journal" duplicate$ item.check
  703.       " " * format.vol.num.pages * output
  704.     }
  705.     { format.article.crossref output.nonnull
  706.       format.pages output
  707.     }
  708.   if$
  709.   new.block
  710.   note output
  711.   fin.entry
  712.   write.url
  713. }
  714.  
  715. FUNCTION {book}
  716. { output.bibitem
  717.   list.label.output
  718.   ": " list.year * output.nonnull
  719.   author empty$
  720.     { editor "author and editor" item.check }
  721.     { crossref missing$
  722.     { "author and editor" editor either.or.check }
  723.     'skip$
  724.       if$
  725.     }
  726.   if$
  727.   title.field field.used =
  728.     { skip$ }
  729.     { format.btitle "title" output.check }
  730.   if$
  731.   crossref missing$
  732.     { format.bvolume output
  733.       format.number.series output
  734.       format.edition output
  735.       publisher "publisher" output.check
  736.       address output
  737.     }
  738.     { format.book.crossref output.nonnull
  739.       format.edition output
  740.     }
  741.   if$
  742.   new.block
  743.   note output
  744.   fin.entry
  745.   write.url
  746. }
  747.  
  748. FUNCTION {booklet}
  749. { output.bibitem
  750.   list.label.output
  751.   ": " list.year * output.nonnull
  752.   title.field field.used =
  753.     { skip$ }
  754.     { format.title "title" output.check }
  755.   if$
  756.   howpublished output
  757.   address output
  758.   new.block
  759.   note output
  760.   fin.entry
  761.   write.url
  762. }
  763.  
  764. FUNCTION {inbook}
  765. { output.bibitem
  766.   list.label.output
  767.   ": " list.year * output.nonnull
  768.   author empty$
  769.     { editor "author and editor" item.check }
  770.     { crossref missing$
  771.     { "author and editor" editor either.or.check }
  772.     'skip$
  773.       if$
  774.     }
  775.   if$
  776.   title.field field.used =
  777.     { skip$ }
  778.     { format.btitle "title" output.check }
  779.   if$
  780.   crossref missing$
  781.     { format.bvolume output
  782.       format.number.series output
  783.       format.edition output
  784.       publisher "publisher" output.check
  785.       address output
  786.     }
  787.     { format.book.crossref output.nonnull
  788.       format.edition output
  789.     }
  790.   if$
  791.   format.chapter.pages "chapter and pages" output.check
  792.   new.block
  793.   note output
  794.   fin.entry
  795.   write.url
  796. }
  797.  
  798. FUNCTION {incollection}
  799. { output.bibitem
  800.   list.label.output
  801.   ": " list.year * output.nonnull
  802.   title.field field.used =
  803.     { skip$ }
  804.     { format.title "title" output.check }
  805.   if$
  806.   author "author" item.check
  807.   crossref missing$
  808.     { format.in.ed.booktitle "booktitle" output.check
  809.       format.edition output
  810.       format.bvolume output
  811.       format.number.series output
  812.       publisher "publisher" output.check
  813.       address output
  814.     }
  815.     { format.incoll.inproc.crossref output.nonnull
  816.     }
  817.   if$
  818.   format.chapter.pages output
  819.   new.block
  820.   note output
  821.   fin.entry
  822.   write.url
  823. }
  824.  
  825. FUNCTION {inproceedings}
  826. { output.bibitem
  827.   list.label.output
  828.   ": " list.year * output.nonnull
  829.   title.field field.used =
  830.     { skip$ }
  831.     { format.title "title" output.check }
  832.   if$
  833.   author "author" item.check
  834.   crossref missing$
  835.     { format.in.ed.booktitle "booktitle" output.check
  836.       format.bvolume output
  837.       format.number.series output
  838.       address empty$
  839.     { organization output
  840.       publisher output
  841.     }
  842.     { organization output
  843.       publisher output
  844.       address output.nonnull
  845.     }
  846.       if$
  847.     }
  848.     { format.incoll.inproc.crossref output.nonnull
  849.     }
  850.   if$
  851.   format.pages output
  852.   new.block
  853.   note output
  854.   fin.entry
  855.   write.url
  856. }
  857.  
  858. FUNCTION {conference} { inproceedings }
  859.  
  860. FUNCTION {manual}
  861. { output.bibitem
  862.   list.label.output
  863.   ": " list.year * output.nonnull
  864.   title.field field.used =
  865.     { skip$ }
  866.     { format.btitle "title" output.check }
  867.   if$
  868.   format.edition output
  869.   author empty$
  870.     { organization empty$
  871.     { address output
  872.     }
  873.     'skip$
  874.       if$
  875.     }
  876.     { organization output
  877.       address output
  878.     }
  879.   if$
  880.   new.block
  881.   note output
  882.   fin.entry
  883.   write.url
  884. }
  885.  
  886. FUNCTION {mastersthesis}
  887. { output.bibitem
  888.   list.label.output
  889.   ": " list.year * output.nonnull
  890.   author "author" item.check
  891.   title.field field.used =
  892.     { skip$ }
  893.     { format.title emphasize "title" output.check }
  894.   if$
  895.   "Master's thesis" format.thesis.type output.nonnull
  896.   school "school" output.check
  897.   address output
  898.   new.block
  899.   note output
  900.   fin.entry
  901.   write.url
  902. }
  903.  
  904. FUNCTION {misc}
  905. { output.bibitem
  906.   list.label.output
  907.   ": " list.year * output.nonnull
  908.   title.field field.used =
  909.     { skip$ }
  910.     { format.title output }
  911.   if$
  912.   howpublished output
  913.   new.block
  914.   note output
  915.   fin.entry
  916.   write.url
  917.   empty.misc.check
  918. }
  919.  
  920. FUNCTION {phdthesis}
  921. { output.bibitem
  922.   list.label.output
  923.   ": " list.year * output.nonnull
  924.   author "author" item.check
  925.   title.field field.used =
  926.     { skip$ }
  927.     { format.btitle "title" output.check }
  928.   if$
  929.   "PhD thesis" format.thesis.type output.nonnull
  930.   school "school" output.check
  931.   address output
  932.   new.block
  933.   note output
  934.   fin.entry
  935.   write.url
  936. }
  937.  
  938. FUNCTION {proceedings}
  939. { output.bibitem
  940.   list.label.output
  941.   ": " list.year * output.nonnull
  942.   title.field field.used =
  943.     { skip$ }
  944.     { format.btitle "title" output.check }
  945.   if$
  946.   format.bvolume output
  947.   format.number.series output
  948.   address empty$
  949.     { editor empty$
  950.     { skip$ }
  951.     { organization output
  952.     }
  953.       if$
  954.       publisher output
  955.     }
  956.     { editor empty$
  957.     'skip$
  958.     { organization output }
  959.       if$
  960.       publisher output
  961.       address output.nonnull
  962.     }
  963.   if$
  964.   new.block
  965.   note output
  966.   fin.entry
  967.   write.url
  968. }
  969.  
  970. FUNCTION {techreport}
  971. { output.bibitem
  972.   list.label.output
  973.   ": " list.year * output.nonnull
  974.   author "author" item.check
  975.   title.field field.used =
  976.     { skip$ }
  977.     { format.title "title" output.check }
  978.   if$
  979.   format.tr.number emphasize output.nonnull
  980.   institution "institution" output.check
  981.   address output
  982.   new.block
  983.   note output
  984.   fin.entry
  985.   write.url
  986. }
  987.  
  988. FUNCTION {unpublished}
  989. { output.bibitem
  990.   list.label.output
  991.   ": " list.year * output.nonnull
  992.   author "author" item.check
  993.   title.field field.used =
  994.     { skip$ }
  995.     { format.title "title" output.check }
  996.   if$
  997.   new.block
  998.   note "note" output.check
  999.   fin.entry
  1000.   write.url
  1001. }
  1002.  
  1003. FUNCTION {default.type} { misc }
  1004.  
  1005. MACRO {jan} {"January"}
  1006.  
  1007. MACRO {feb} {"February"}
  1008.  
  1009. MACRO {mar} {"March"}
  1010.  
  1011. MACRO {apr} {"April"}
  1012.  
  1013. MACRO {may} {"May"}
  1014.  
  1015. MACRO {jun} {"June"}
  1016.  
  1017. MACRO {jul} {"July"}
  1018.  
  1019. MACRO {aug} {"August"}
  1020.  
  1021. MACRO {sep} {"September"}
  1022.  
  1023. MACRO {oct} {"October"}
  1024.  
  1025. MACRO {nov} {"November"}
  1026.  
  1027. MACRO {dec} {"December"}
  1028.  
  1029. MACRO {acmcs} {"ACM Computing Surveys"}
  1030.  
  1031. MACRO {acta} {"Acta Informatica"}
  1032.  
  1033. MACRO {cacm} {"Communications of the ACM"}
  1034.  
  1035. MACRO {ibmjrd} {"IBM Journal of Research and Development"}
  1036.  
  1037. MACRO {ibmsj} {"IBM Systems Journal"}
  1038.  
  1039. MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
  1040.  
  1041. MACRO {ieeetc} {"IEEE Transactions on Computers"}
  1042.  
  1043. MACRO {ieeetcad}
  1044.  {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
  1045.  
  1046. MACRO {ipl} {"Information Processing Letters"}
  1047.  
  1048. MACRO {jacm} {"Journal of the ACM"}
  1049.  
  1050. MACRO {jcss} {"Journal of Computer and System Sciences"}
  1051.  
  1052. MACRO {scp} {"Science of Computer Programming"}
  1053.  
  1054. MACRO {sicomp} {"SIAM Journal on Computing"}
  1055.  
  1056. MACRO {tocs} {"ACM Transactions on Computer Systems"}
  1057.  
  1058. MACRO {tods} {"ACM Transactions on Database Systems"}
  1059.  
  1060. MACRO {tog} {"ACM Transactions on Graphics"}
  1061.  
  1062. MACRO {toms} {"ACM Transactions on Mathematical Software"}
  1063.  
  1064. MACRO {toois} {"ACM Transactions on Office Information Systems"}
  1065.  
  1066. MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
  1067.  
  1068. MACRO {tcs} {"Theoretical Computer Science"}
  1069.  
  1070. READ
  1071.  
  1072. EXECUTE {init.field.constants}
  1073.  
  1074. FUNCTION {sortify}
  1075. { purify$
  1076.   "l" change.case$
  1077. }
  1078.  
  1079. FUNCTION {sortify.names}
  1080. { " and " " " replace.substring
  1081.   " et~al." " zzz" replace.substring
  1082.   sortify
  1083. }
  1084.  
  1085. FUNCTION {author.key.label}
  1086. { author empty$
  1087.     { key empty$
  1088.     { title.field 'field.used := }
  1089.     { key.field 'field.used := }
  1090.       if$
  1091.     }
  1092.     { author.field 'field.used := }
  1093.   if$
  1094. }
  1095.  
  1096. FUNCTION {author.editor.key.label}
  1097. { author empty$
  1098.     { editor empty$
  1099.     { key empty$
  1100.         { title.field 'field.used := }
  1101.         { key.field 'field.used := }
  1102.       if$
  1103.       }
  1104.     { editor.field 'field.used := }
  1105.       if$
  1106.     }
  1107.     { author.field 'field.used := }
  1108.   if$
  1109. }
  1110.  
  1111. FUNCTION {author.key.organization.label}
  1112. { author empty$
  1113.     { key empty$
  1114.     { organization empty$
  1115.         { title.field 'field.used := }
  1116.         { organization.field 'field.used := }
  1117.       if$
  1118.     }
  1119.     { key.field 'field.used := }
  1120.       if$
  1121.     }
  1122.     { author.field 'field.used := }
  1123.   if$
  1124. }
  1125.  
  1126. FUNCTION {editor.key.organization.label}
  1127. { editor empty$
  1128.     { key empty$
  1129.     { organization empty$
  1130.         { title.field 'field.used := }
  1131.         { organization.field 'field.used := }
  1132.       if$
  1133.     }
  1134.     { key.field 'field.used := }
  1135.       if$
  1136.     }
  1137.     { editor.field 'field.used := }
  1138.   if$
  1139. }
  1140.  
  1141. FUNCTION {sort.format.title}
  1142. { 't :=
  1143.   "A " #2
  1144.     "An " #3
  1145.       "The " #4 t chop.word
  1146.     chop.word
  1147.   chop.word
  1148.   sortify
  1149.   #1 global.max$ substring$
  1150. }
  1151.  
  1152. FUNCTION {calc.label}
  1153. { make.abbr.label
  1154.   title.field field.used =
  1155.     { sort.format.title }
  1156.     { sortify.names }
  1157.   if$
  1158.   year field.or.null purify$ #-1 #4 substring$ sortify
  1159.   *
  1160.   'sort.label :=
  1161. }
  1162.  
  1163. FUNCTION {preliminaries} %%%XXX change
  1164. { type$ "book" =
  1165.   type$ "inbook" =
  1166.   or
  1167.     'author.editor.key.label
  1168.     { type$ "proceedings" =
  1169.     'editor.key.organization.label
  1170.     { type$ "manual" =
  1171.         'author.key.organization.label
  1172.         'author.key.label
  1173.       if$
  1174.     }
  1175.       if$
  1176.     }
  1177.   if$
  1178.   author.field field.used = %%%XXX change
  1179.     {
  1180.       author num.names$ #2 >
  1181.         { #1 }
  1182.         { #0 }
  1183.       if$
  1184.       'etal.required :=
  1185.     }
  1186.     {
  1187.       editor.field field.used = 
  1188.         {
  1189.           editor num.names$ #2 >
  1190.             { #1 }
  1191.             { #0 }
  1192.           if$
  1193.         }
  1194.         { #0 }
  1195.       if$
  1196.       'etal.required :=
  1197.     }
  1198.   if$
  1199.   #1 'etal.allowed :=
  1200. }
  1201.  
  1202. FUNCTION {first.presort}
  1203. { calc.label
  1204.   sort.label
  1205.   title.field field.used =
  1206.     { skip$ }
  1207.     { "    "
  1208.       *
  1209.       make.list.label sortify.names
  1210.       *
  1211.       "    "
  1212.       *
  1213.       title field.or.null
  1214.       sort.format.title
  1215.       *
  1216.     }
  1217.   if$
  1218.   #1 entry.max$ substring$
  1219.   'sort.key$ :=
  1220. }
  1221.  
  1222. ITERATE {preliminaries}
  1223.  
  1224. ITERATE {first.presort}
  1225.  
  1226. SORT
  1227.  
  1228. STRINGS { last.sort.label next.extra last.full.label }
  1229.  
  1230. INTEGERS { last.extra.num last.etal.allowed }
  1231.  
  1232. FUNCTION {initialize.confusion}
  1233. { #0 int.to.chr$ 'last.sort.label :=
  1234.   #0 int.to.chr$ 'last.full.label :=
  1235.   #1 'last.etal.allowed :=
  1236. }
  1237.  
  1238. FUNCTION {confusion.pass}
  1239. { last.sort.label sort.label =
  1240.     { last.etal.allowed 
  1241.         { last.full.label make.full.label sortify.names =
  1242.             { skip$ }
  1243.             { #0 'etal.allowed :=
  1244.               #0 'last.etal.allowed :=
  1245.             }
  1246.           if$
  1247.         }
  1248.         { #0 'etal.allowed := }
  1249.       if$
  1250.     }
  1251.     { sort.label 'last.sort.label :=
  1252.       make.full.label sortify.names 'last.full.label :=
  1253.       #1 'last.etal.allowed :=
  1254.     }
  1255.   if$
  1256. }
  1257.  
  1258. EXECUTE {initialize.confusion}
  1259.  
  1260. ITERATE {confusion.pass}
  1261.  
  1262. EXECUTE {initialize.confusion}
  1263.  
  1264. REVERSE {confusion.pass}
  1265.  
  1266. FUNCTION {initialize.last.extra.num}
  1267. { #0 int.to.chr$ 'last.sort.label :=
  1268.   "" 'next.extra :=
  1269.   #0 'last.extra.num :=
  1270. }
  1271.  
  1272. FUNCTION {forward.pass}
  1273. { last.sort.label sort.label =
  1274.     { last.extra.num #1 + 'last.extra.num :=
  1275.       last.extra.num int.to.chr$ 'extra.label :=
  1276.     }
  1277.     { "a" chr.to.int$ 'last.extra.num :=
  1278.       "" 'extra.label :=
  1279.       sort.label 'last.sort.label :=
  1280.     }
  1281.   if$
  1282. }
  1283.  
  1284. FUNCTION {reverse.pass}
  1285. { next.extra "b" =
  1286.     { "a" 'extra.label := }
  1287.     'skip$
  1288.   if$
  1289.   year empty$
  1290.     { "n.d." extra.label * 'list.year := }
  1291.     { year extra.label * 'list.year := }
  1292.   if$
  1293.   extra.label 'next.extra :=
  1294. }
  1295.  
  1296. ITERATE {first.presort}
  1297.  
  1298. SORT
  1299.  
  1300. EXECUTE {initialize.last.extra.num}
  1301.  
  1302. ITERATE {forward.pass}
  1303.  
  1304. REVERSE {reverse.pass}
  1305.  
  1306. FUNCTION {second.presort}
  1307. { make.list.label
  1308.   title.field field.used =
  1309.     { sort.format.title }
  1310.     { sortify.names }
  1311.   if$
  1312.   "    "
  1313.   *
  1314.   list.year field.or.null sortify
  1315.   *
  1316.   "    "
  1317.   *
  1318.   title.field field.used =
  1319.     { skip$ }
  1320.     { title field.or.null
  1321.       sort.format.title
  1322.       *
  1323.     }
  1324.   if$
  1325.   #1 entry.max$ substring$
  1326.   'sort.key$ :=
  1327. }
  1328.  
  1329. ITERATE {second.presort}
  1330.  
  1331. SORT
  1332.  
  1333. FUNCTION {begin.bib}
  1334. { preamble$ empty$
  1335.     'skip$
  1336.     { preamble$ write$ newline$ }
  1337.   if$
  1338.   "\begin{thebibliography}{xx}" write$ newline$
  1339. }
  1340.  
  1341. EXECUTE {begin.bib}
  1342.  
  1343. EXECUTE {init.state.consts}
  1344.  
  1345. ITERATE {call.type$}
  1346.  
  1347. FUNCTION {end.bib}
  1348. { newline$
  1349.   "\end{thebibliography}" write$ newline$
  1350. }
  1351.  
  1352. EXECUTE {end.bib}
  1353.